package com.cleaningcloud.cld.controller;

import com.cleaningcloud.cld.domain.vo.CldProjectSetVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.cleaningcloud.common.log.annotation.Log;
import com.cleaningcloud.common.log.enums.BusinessType;
import com.cleaningcloud.common.security.annotation.RequiresPermissions;
import com.cleaningcloud.cld.service.ICldProjectSetService;
import com.cleaningcloud.common.core.web.controller.BaseController;
import com.cleaningcloud.common.core.web.domain.AjaxResult;
import com.cleaningcloud.common.core.utils.poi.ExcelUtil;

/**
 * 项目配置Controller
 * 
 * @author cleaningcloud
 * @date 2024-10-15
 */
@RestController
@RequestMapping("/set")
public class CldProjectSetController extends BaseController
{
    @Autowired
    private ICldProjectSetService cldProjectSetService;


    /**
     * 获取项目配置详细信息
     */
    @GetMapping(value = "/{projectId}")
    public AjaxResult getInfo(@PathVariable("projectId") Long projectId)
    {
        return success(cldProjectSetService.selectCldProjectSetByProjectId(projectId));
    }

    /**
     * 获取项目配置详细信息
     */
    @GetMapping(value = "/getProjectSet/{projectId}")
    public AjaxResult getProjectSet(@PathVariable("projectId") Long projectId)
    {
        return success(cldProjectSetService.getCldProjectSetByProjectId(projectId));
    }

    /**
     * 新增项目配置
     */
    @Log(title = "项目配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CldProjectSetVo cldProjectSetVo)
    {
        return toAjax(cldProjectSetService.insertCldProjectSet(cldProjectSetVo));
    }

}
